<template>
  <div class="record">

    <p>店铺名：{{detailData.name}}</p>
    <img :src="detailData.shopImage"
         alt="商户">
    <p>店铺类型：{{detailData.type | formatType}}</p>
    <p>身份证号：{{detailData.cardNumber}}</p>
    <p>店长：{{detailData.personName}}</p>
    <p>创建时间：{{detailData.createTime}}</p>

    <p>店铺评分：{{detailData.evaluateScore}}.0分</p>
    <p>联系电话：{{detailData.phone}}</p>
    <p>微信号：{{detailData.wechat}}</p>
    <p>商户地址：{{addressAll}}</p>
    <p :class="detailData.approveStatus==1?'approve':''">状态：{{detailData.approveStatus==1?'审核通过':'审核不通过'}}</p>

    <el-button type="primary"
               @click="$router.back(-1)">返回</el-button>

  </div>
</template>

<script>
import { queryDetailById } from "../../services/services_shop";
// approveStatus: 1
// businessEndTime: "2021-07-01 00:00:00"
// businessStartTime: "2021-09-01 00:00:00"
// cardNumber: "330121232122123"
// createTime: "2021-07-19 22:09:22"
// detailAddress: "余杭区政府大本营"
// distance: null
// evaluateScore: "4"
// id: 1
// isEnable: 1
// latitude: 30.425
// level1Address: "山西"
// level1AddressCode: 123
// level2Address: "晋中市"
// level2AddressCode: 234
// level3Address: "和顺县"
// level3AddressCode: 345
// longitude: 120.306
// name: "全堂店铺"
// personName: "小飞飞"
// phone: "1373802019"
// remake: null
// shopImage: null
// supportDelivery: 0
// type: "AUTH_STORE"
// updateTime: "2021-07-20 13:59:32"
// userId: 6666
// wechat: "testWeChar123"
export default {
  name: "ShangHuDetail",
  data () {
    return {
      detailData: {}
    };
  },
  computed: {
    addressAll () {
      const { level1Address, level2Address, level3Address, detailAddress } = this.detailData
      return level1Address + ' ' + level2Address + ' ' + level3Address + ' ' + detailAddress
    }
  },
  created () {
    console.log(this.$route);
    this.getDetailById();
  },
  methods: {
    // 获取数据
    async getDetailById () {
      const { shopId } = this.$route.query
      try {
        const res = await queryDetailById(shopId);
        if (res.code == 0) {
          this.detailData = res.data
        }
      } catch (e) {
        console.error(e);
      }
    },
  },
  filters: {
    formatType (type) {
      if (type == 'AUTH_STORE') {
        return '授权店'
      } else {
        return '专卖店'
      }
    }
  }
};
</script>

<style>
.record {
  padding: 0px 20px 0 20px;
}
.btn-list {
  margin-bottom: 18px;
}
</style>
